<script setup lang="ts">
import { ref } from "vue";

defineProps<{ msg: string }>();

const count = ref(0);

const onCountClick = (val: string) => {
  val === "add" ? count.value++ : count.value && count.value--;
};
</script>

<template>
  <h1>{{ msg }}</h1>
  <button @click="onCountClick('sub')">-1</button>
  {{count}}
  <button @click="onCountClick('add')">+1</button>
</template>

<style  scoped>
</style>
